﻿<UserControl x:Class="Gallery.MainView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
             xmlns:local="clr-namespace:Gallery"
             xmlns:apexControls="clr-namespace:Apex.Controls;assembly=Apex.Silverlight"
            xmlns:cueTextBox="clr-namespace:Gallery.CueTextBox"
             mc:Ignorable="d" 
             d:DesignHeight="768" d:DesignWidth="1024">
    
    <UserControl.DataContext>
        <local:GalleryViewModel />
    </UserControl.DataContext>
    
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Gallery.Silverlight;component/Resources/ResourceDictionaries/GalleryResources.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    
    <apexControls:ApexGrid Columns="*,Auto,3*">
        
        <!-- The main tree view of samples. -->
        <sdk:TreeView 
            ItemsSource="{Binding GalleryItems}" SelectedItemChanged="TreeView_SelectedItemChanged">
            <sdk:TreeView.ItemTemplate>
                <sdk:HierarchicalDataTemplate ItemsSource="{Binding GalleryItems}">
                    <TextBlock Text="{Binding Title}" />
                </sdk:HierarchicalDataTemplate>
            </sdk:TreeView.ItemTemplate>
        </sdk:TreeView>
        
        <!-- The splitter. -->
        <sdk:GridSplitter Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" />
        
        <!-- The view broker. -->        
        <apexControls:ViewBroker 
            Grid.Column="2" ViewModel="{Binding SelectedGalleryItem}" AllowUnknownViewModels="True" 
            HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
        
    </apexControls:ApexGrid>
</UserControl>
